package com.example.boot.test.mapper;

import com.example.boot.commen.utils.MyMapper;
import com.example.boot.test.model.Account;
import org.apache.ibatis.annotations.*;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author ruiwu
 * @version V1.0
 * @Description:
 */
@Mapper
public interface DemoMapper
{
    //第二种方式，使用mybaties3.0后新特性
    /*@Results(id = "accountResult", value ={
            @Result(property = "id", column = "id", id = true),
            @Result(property = "name", column = "name", id = true),
            @Result(property = "money", column = "money", id = true)
    })
    //@ResultMap("accountResult")*/
    @Select("SELECT * FROM account")
    List<Account> findAllAccount();

    @Update("UPDATE account set money=#{money} WHERE id=#{id}")
    void testTransactional(@Param("money")double money,@Param("id")int id);
}
